﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;

namespace AppDesignerTest
{
    [ContentProperty("StringProp")]
    public class ExampleClass : ISupportInitialize
    {
        #region Fields

        private string _stringProp;
        private string _otherProp;
        private string _otherProp2;
        private object _objectProp;
        public static int nextUniqueIndex;
        int uniqueIndex = nextUniqueIndex++;

        #endregion

        #region Cosntructor

        public ExampleClass()
        {
            LogHelper.Log("ctor" + this.Identity);
        }

        #endregion
        
        #region Property

        public string Identity
        {
            get
            {
                return GetType().Name + "(" + uniqueIndex + ")";
            }
        }

        public string StringProp
        {
            get
            {
                LogHelper.Log("StringProp.Get" + Identity);
                return _stringProp;
            }
            set
            {
                LogHelper.Log("StringProp.Set" + value + " - " + Identity);
                _stringProp = value;
            }
        }

        public string OtherProp
        {
            get
            {
                LogHelper.Log("OtherProp.Get" + Identity);
                return _otherProp;
            }
            set
            {
                LogHelper.Log("OtherProp.Set" + value + " - " + Identity);
                _otherProp = value;
            }
        }

        public string OtherProp2
        {
            get
            {
                LogHelper.Log("OtherProp2.Get" + Identity);
                return _otherProp2;
            }
            set
            {
                LogHelper.Log("OtherProp2.Set" + value + " - " + Identity);
                _otherProp2 = value;
            }
        }

        public object ObjectProp
        {
            get
            {
                LogHelper.Log("ObjectProp.Get" + Identity);
                return _objectProp;
            }
            set
            {
                LogHelper.Log("ObjectProp.Set" + value + " - " + Identity);
                _objectProp = value;
            }
        }

        #endregion

        #region Method

        public void BeginInit()
        {
            LogHelper.Log("BeginInit" + Identity);
        }

        public void EndInit()
        {
            LogHelper.Log("EndInit" + Identity);
        }

        #endregion

    }
}
